<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Recharge extends Model
{   
    protected $table = 'recharges';
    //
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'money',
        'fee',
        'out_trade_no',
        'transaction_id',
        'type',
        'pay_time',
        'status'
    ];

    public function status(){
        $status = ['未支付','已支付'];
        return $status[$this->status];
    }

    public function type(){
        $types = ['微信支付','扫码支付','银联支付'];
        return $types[$this->type-1];
    }

    public function statuslabel(){
        $status = ['label-primary ','label-success','label-danger'];
        return $status[$this->status];
    }

    public function user(){
        return $this->belongsTo('App\User');
    }   

}
